package com.tanhua.server.controller;

/**
 * @Author: cl
 * @Date: 2022/5/10 - 05 - 10
 * @Description:
 */

import com.tanhua.model.vo.NearUserVo;
import com.tanhua.server.interceptor.UserHolder;
import com.tanhua.server.service.BaiduService;
import com.tanhua.server.service.TanhuaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * 用户地理位置模块
 */
@RestController
@RequestMapping("/baidu")
public class BaiduController {

    @Autowired
    private BaiduService baiduService;


    /**
     * 上传当前地理位置
     *
     * @param param
     * @return
     */
    @PostMapping("/location")
    public ResponseEntity location(@RequestBody Map param) {

        Double longitude = Double.valueOf(param.get("longitude").toString());//经度
        Double latitude = Double.valueOf(param.get("latitude").toString());//纬度
        String addrStr = param.get("addrStr").toString();//详细地址
        baiduService.location(UserHolder.getUserId(), longitude, latitude, addrStr);
        return ResponseEntity.ok("地理位置上传成功");
    }
}
